﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Terran
{
	public class ActionProduceBarracks : ActionProduceFromSCV
	{
		public static ActionProduceBarracks Instance = new ActionProduceBarracks();

		private ActionProduceBarracks() : base(60, 150, 0) { }

		public override string EventName { get { return "ActionSpawnBarracks"; } }

		public override TerranState.TerranBuilding GetBuilding(TerranState state) { return state.Barracks; }

		public override bool IsInvalid(IBuildOrder bo)
		{
			TerranState state = bo.State as TerranState;
			return base.IsInvalid(bo) || state.SupplyDepot.Total == 0;
		}

		public override bool HaveTechnology(IBuildOrder bo)
		{
			TerranState state = bo.State as TerranState;
			return state.SupplyDepot.Count > 0;
		}

		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceSupplyDepot.Instance } };
				return m_Requirements;
			}
		}
	}
}
